package com.yxhl.zoume.domain.interactor.appraisal;

import com.yxhl.zoume.data.http.repository.appraisal.AppraisalRepository;
import com.yxhl.zoume.data.http.rest.param.appraisal.AppraisalParam;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.response.appraisal.AppraisalResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by vhawk on 16/9/18.
 */
public class AppraisalUseCase extends UseCase<AppraisalResponse> {

    private final AppraisalRepository repository;

    @Inject
    public AppraisalUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread, @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread, AppraisalRepository repository) {
        super(uiThread, executorThread);
        this.repository = repository;
    }

    @Override
    protected Observable<AppraisalResponse> buildObservable(RequestParamImpl param) {
        return repository.appraiseDriver((AppraisalParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
